﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdMLSegment : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdMLSegment(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdMLSegment obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdMLSegment()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdMLSegment(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGeDoubleArray m_AreaFillParams
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdMLSegment_m_AreaFillParams_get(this.swigCPtr);
				OdGeDoubleArray result = (intPtr == IntPtr.Zero) ? null : new OdGeDoubleArray(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdMLSegment_m_AreaFillParams_set(this.swigCPtr, OdGeDoubleArray.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGeDoubleArray m_SegParams
		{
			get
			{
				IntPtr intPtr = TD_DbPINVOKE.OdMLSegment_m_SegParams_get(this.swigCPtr);
				OdGeDoubleArray result = (intPtr == IntPtr.Zero) ? null : new OdGeDoubleArray(intPtr, false);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				TD_DbPINVOKE.OdMLSegment_m_SegParams_set(this.swigCPtr, OdGeDoubleArray.getCPtr(value));
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdMLSegment() : this(TD_DbPINVOKE.new_OdMLSegment(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
